package com.fenghongzhang.day008;

import androidx.appcompat.app.AppCompatActivity;

import android.os.Bundle;
import android.view.Gravity;
import android.view.View;
import android.widget.AdapterView;
import android.widget.ListView;
import android.widget.PopupWindow;

import java.util.ArrayList;
import java.util.List;

public class Main4Activity extends AppCompatActivity {
    private ListView lv;

    private MyAdpater myAdpater;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main4);


        lv = (ListView) findViewById(R.id.lv);

        List<String> list = new ArrayList<>();
        list.add("第一条");
        list.add("第一条");
        list.add("第一条");
        list.add("第一条");
        list.add("第一条");


        myAdpater = new MyAdpater(list, this);
        lv.setAdapter(myAdpater);
        lv.setOnItemLongClickListener(new AdapterView.OnItemLongClickListener() {
            @Override
            public boolean onItemLongClick(AdapterView<?> parent, View view, int position, long id) {

                myAdpater.setFlag(true);
                myAdpater.notifyDataSetChanged();

//
//                //开始一个popWindow
//                PopupWindow popupWindow = new PopupWindow(Main4Activity.this);
//                // xml -> view
////                popupWindow.setContentView();
//
//                //底部弹出
//                //当前的页面转化成一个view
//                popupWindow.showAtLocation(, Gravity.BOTTOM,0,0);

                //截断
                return true;
            }
        });


    }
}
